#
# Copyright (C) 2006-2012 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=cpufrequtils
PKG_VERSION:=008
PKG_RELEASE:=3

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=@SF/linux-diag
PKG_HASH:=skip
PKG_MAINTAINER:=Dominik Brodowski <linux@dominikbrodowski.net>

PKG_LICENSE:=LGPL-2.1
PKG_LICENSE_FILES:=COPYING cmd/GPL lib/LGPL

PKG_FIXUP:=autoreconf

PKG_INSTALL:=1

include $(INCLUDE_DIR)/package.mk

define Package/libcpufreq
  SECTION:=libs
  CATEGORY:=Libraries
  SUBMENU:=Filesystem
  DEPENDS:=+libsysfs
  TITLE:=(LEDE) Cpufreq library
  URL:=http://linux-diag.sourceforge.net/cpufrequtils.html
  ABI_VERSION:=2
endef

define Package/cpufrequtils
  SECTION:=utils
  CATEGORY:=Utilities
  SUBMENU:=Filesystem
  DEPENDS:=+libcpufreq
  TITLE:=(LEDE) Cpufreq Utilities Based on Sysfs
  URL:=http://linux-diag.sourceforge.net/cpufrequtils.html
endef

define Package/libcpufreq/description
The library's purpose is to provide a consistant and stable interface for
querying system device information exposed through sysfs.
endef

define Package/cpufrequtils/description
A utility built upon libsysfs that lists devices by bus, class, and topology.
endef

define Build/InstallDev
	$(INSTALL_DIR) $(1)/usr/include
	$(CP) $(PKG_INSTALL_DIR)/usr/include/cpufreq.h $(1)/usr/include/

	$(INSTALL_DIR) $(1)/usr/lib
	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libcpufreq.so* $(1)/usr/lib/
endef

define Package/libcpufreq/install
	$(INSTALL_DIR) $(1)/usr/lib
	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libcpufreq.so.* $(1)/usr/lib/
endef

define Package/cpufrequtils/install
	$(INSTALL_DIR) $(1)/usr/bin
	$(CP) $(PKG_INSTALL_DIR)/usr/bin/cpufreq-* $(1)/usr/bin/
endef

define Package/cpufrequtils/conffiles

endef

$(eval $(call BuildPackage,libcpufreq))
$(eval $(call BuildPackage,cpufrequtils))
